package edu.tju.honour;

import java.sql.SQLException;

import java.util.List;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.younker.waf.db.IBatisConfig;


public class IbatisHonourDao implements IHonourDao{
	protected SqlMapClient sqlMap = IBatisConfig.getSqlMapInstance();



	@Override
	public void deleteHonour(long id) throws SQLException {
		sqlMap.delete("deleteHonour", id);
		
	}

	@Override
	public List<Honour> getHonourAnd(Honour honour) throws SQLException {
		return sqlMap.queryForList("getHonourAnd", honour);
	}

	@Override
	public Honour getHonourById(long id) throws SQLException {
		return (Honour) sqlMap.queryForObject("getHonourById", id);
	}

	@Override
	public List<Honour> getHonourOr(Honour honour) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Long insertHonour(Honour honour) throws SQLException {
		return (Long)sqlMap.insert("insertHonour", honour);
	}

	@Override
	public int updateHonour(Honour honour) throws SQLException {
		return sqlMap.update("updateHonour", honour);
	}

}
